/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Marcio
 */
@Entity
@Table(name = "SGMUNICIPIO")
@NamedQueries({
    @NamedQuery(name = "Sgmunicipio.findAll", query = "SELECT s FROM Sgmunicipio s"),
    @NamedQuery(name = "Sgmunicipio.findBySiglaUf", query = "SELECT s FROM Sgmunicipio s WHERE s.sgmunicipioPK.siglauf like :siglauf"),
    @NamedQuery(name = "Sgmunicipio.findByNomeMunic", query = "SELECT s FROM Sgmunicipio s WHERE s.nomemunic = :nomemunic and s.sgmunicipioPK.siglauf like :siglauf")})
public class Sgmunicipio implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SgmunicipioPK sgmunicipioPK;
    @Basic(optional = false)
    @Column(name = "NOMEMUNIC")
    private String nomemunic;
    @Basic(optional = false)
    @Column(name = "DDDMUNIC")
    private String dddmunic;
    @Basic(optional = false)
    @Column(name = "DTINS")
    @Temporal(TemporalType.DATE)
    private Date dtins;
    @Basic(optional = false)
    @Column(name = "HINS")
    @Temporal(TemporalType.TIME)
    private Date hins;
    @Basic(optional = false)
    @Column(name = "IDUSUINS")
    private String idusuins;
    @Column(name = "DTALT")
    @Temporal(TemporalType.DATE)
    private Date dtalt;
    @Column(name = "HALT")
    @Temporal(TemporalType.TIME)
    private Date halt;
    @Column(name = "IDUSUALT")
    private String idusualt;
    @JoinColumns({
        @JoinColumn(name = "SIGLAUF", referencedColumnName = "SIGLAUF", insertable = false, updatable = false),
        @JoinColumn(name = "CODPAIS", referencedColumnName = "CODPAIS", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Sguf sguf;

    public Sgmunicipio() {
    }

    public Sgmunicipio(SgmunicipioPK sgmunicipioPK) {
        this.sgmunicipioPK = sgmunicipioPK;
    }

    public Sgmunicipio(SgmunicipioPK sgmunicipioPK, String nomemunic, String dddmunic, Date dtins, Date hins, String idusuins) {
        this.sgmunicipioPK = sgmunicipioPK;
        this.nomemunic = nomemunic;
        this.dddmunic = dddmunic;
        this.dtins = dtins;
        this.hins = hins;
        this.idusuins = idusuins;
    }

    public Sgmunicipio(String codmunic, String siglauf, short codpais) {
        this.sgmunicipioPK = new SgmunicipioPK(codmunic, siglauf, codpais);
    }

    public SgmunicipioPK getSgmunicipioPK() {
        return sgmunicipioPK;
    }

    public void setSgmunicipioPK(SgmunicipioPK sgmunicipioPK) {
        this.sgmunicipioPK = sgmunicipioPK;
    }

    public String getNomemunic() {
        return nomemunic;
    }

    public void setNomemunic(String nomemunic) {
        this.nomemunic = nomemunic;
    }

    public String getDddmunic() {
        return dddmunic;
    }

    public void setDddmunic(String dddmunic) {
        this.dddmunic = dddmunic;
    }

    public Date getDtins() {
        return dtins;
    }

    public void setDtins(Date dtins) {
        this.dtins = dtins;
    }

    public Date getHins() {
        return hins;
    }

    public void setHins(Date hins) {
        this.hins = hins;
    }

    public String getIdusuins() {
        return idusuins;
    }

    public void setIdusuins(String idusuins) {
        this.idusuins = idusuins;
    }

    public Date getDtalt() {
        return dtalt;
    }

    public void setDtalt(Date dtalt) {
        this.dtalt = dtalt;
    }

    public Date getHalt() {
        return halt;
    }

    public void setHalt(Date halt) {
        this.halt = halt;
    }

    public String getIdusualt() {
        return idusualt;
    }

    public void setIdusualt(String idusualt) {
        this.idusualt = idusualt;
    }

    public Sguf getSguf() {
        return sguf;
    }

    public void setSguf(Sguf sguf) {
        this.sguf = sguf;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sgmunicipioPK != null ? sgmunicipioPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sgmunicipio)) {
            return false;
        }
        Sgmunicipio other = (Sgmunicipio) object;
        if ((this.sgmunicipioPK == null && other.sgmunicipioPK != null) || (this.sgmunicipioPK != null && !this.sgmunicipioPK.equals(other.sgmunicipioPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Sgmunicipio[ sgmunicipioPK=" + sgmunicipioPK + " ]";
    }
    
}
